//
//  CustomPicView.m
//  YouGoWeGo
//
//  Created by LiuFei on 14/11/19.
//  Copyright (c) 2014年 LiuFei. All rights reserved.
//

#import "CustomPicView.h"

@implementation CustomPicView

- (void)dealloc
{
    [_contentLabel release];
    [_picImage release];
    [_collectButton release];
    [_commButton release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
     
        self.picImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"2.png"]];
        [_picImage setFrame:CGRectMake(30, 20, self.frame.size.width / 7 * 6, self.frame.size.height / 10 * 7)];
        [self addSubview:_picImage];
        [_picImage release];
        
        self.contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, self.picImage.frame.size.height + self.picImage.frame.origin.y + 20, [UIScreen mainScreen].bounds.size.width - 20, 50)];
        [_contentLabel setNumberOfLines:0];
        [self addSubview:_contentLabel];
        [_contentLabel release];
        
        self.commButton = [[UIButton alloc] initWithFrame:CGRectMake(100, self.frame.size.height / 10 * 9, 80, 30)];
        [_commButton setTag:1004];
        [_commButton setTitle:@"评论" forState:UIControlStateNormal];
        [self addSubview:_commButton];
        [_commButton release];
        
        self.collectButton = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width / 2 + 20, self.frame.size.height / 10 * 9, 80, 30)];
        [_collectButton setTag:1005];
        [_collectButton setTitle:@"喜欢" forState:UIControlStateNormal];
        [self addSubview:_collectButton];
        [_collectButton release];
        
    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    [_contentLabel sizeToFit];
}

@end
